package by.ostrovsky.webhousingsystem.constants;

import java.util.List;

import org.apache.log4j.Logger;

import by.ostrovsky.webhousingsystem.controller.IOperateController;
import by.ostrovsky.webhousingsystem.controller.providedwork.GetProvidedWorkController;
import by.ostrovsky.webhousingsystem.exception.CommonException;
import by.ostrovsky.webhousingsystem.hibernate.entity.ProvidedWork;

public abstract class ServiceDataSource{
	private static Logger logger = Logger
			.getLogger(ServiceDataSource.class);
	private static List<ProvidedWork> dataSource = null;
	protected List<ProvidedWork> specs = null;

	static {
		IOperateController<ProvidedWork, Boolean> controller = new GetProvidedWorkController();
		try {
			dataSource = controller.get();
		} catch (CommonException e) {
			logger.error(e);
		}
	}
	
	protected void cloneList(){
		specs = dataSource;
	}

	public List<ProvidedWork> getSpecs() {
		return specs;
	}

	public void setSpecs(List<ProvidedWork> specs) {
		this.specs = specs;
	}
}
